package io.zt.dangyuan;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;


import java.util.List;

public class BBSMainAdapter2 extends BaseAdapter {
	private  LayoutInflater mInflater;
	private List<String> datas;
	private Context context;

	public BBSMainAdapter2(Context context,List<String> datas) {
		super();
		this.context=context;
		this.datas=datas;
		this.mInflater = LayoutInflater.from(context);
	}
	@Override
	public int getCount() {
		// TODO Auto-generated method stub
		return datas.size();
	}

	@Override
	public Object getItem(int position) {
		// TODO Auto-generated method stub
		return datas.get(position);
	}

	@Override
	public long getItemId(int position) {
		// TODO Auto-generated method stub
		return position;
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		ViewHolder holder = null;
		if (convertView == null) {
			holder=new ViewHolder();
			convertView = mInflater.inflate(R.layout.bbs_main_item, null);
			holder.iv_itemImag = (ImageView) convertView.findViewById(R.id.bbs_item_img);
			holder.tv_itemTitle = (TextView) convertView.findViewById(R.id.bbs_item_title);
			holder.tv_itemTime = (TextView) convertView.findViewById(R.id.bbs_item_time);
			holder.tv_itemState = (TextView) convertView.findViewById(R.id.bbs_item_count);
			convertView.setTag(holder);
		}else {
			holder = (ViewHolder)convertView.getTag();
		}
		return convertView;
	}

	class ViewHolder   {
		TextView tv_itemTitle;
		TextView tv_itemTime;
		TextView tv_itemState;
		ImageView iv_itemImag;
	}



}